<template>
  <div class="patientsInfo plr-30 pt-20">
    <div class="tag plr-15 ptb-10">
      <div
        class="tag-item cp"
        :class="currentindex === index ? 'active' : ''"
        v-for="(item, index) in tablist"
        :key="index"
        @click="changeTab(index, item.type)"
      >
        {{ item.text }}
      </div>
    </div>
    <p class="text-center fz-35" style="color: #110c28">王老五的体检报告</p>
    <div class="chat-box">
      <canvas id="mychat"></canvas>
    </div>
    <div class="general-box mt-20 mb-20">
      <div class="bg-line"></div>
      <div class="content-box pb-10 bs">
        <img
          v-if="!isPlaying"
          src="@/assets/img/icon/player.svg"
          class="posi cp"
          alt=""
          @click="player"
        />

        <div class="voice" v-else @click="player">
          <div class="bg voicePlay"></div>
        </div>
        <audio controls ref="audioPlayer" style="display: none"></audio>
        <div class="text-center fz-30 title">
          <span class="italic"></span>
          <span class="italic-blue mr-17"></span>
          亲爱的
          <!-- 亲爱的<span style="color: #589cf6" class="fz-14">{{
              username
            }}</span> -->
          <span>
            <span class="italic-blue ml-17 mr-3"></span>

            <span class="italic" style="margin-bottom: -2px"></span>
          </span>
        </div>
        <div class="summarize fz-10 plr-15">
          <div class="header flex flex-align-center fz-26">
            <p class="line"></p>
            <p style="color: #78adf5">专家解读</p>
          </div>
          <!-- <p class="lh-18 mt-5 fz-14">
              {{ detailInfo.analysis }}
            </p> -->
          <p class="mt-20 fz-30" style="line-height: 58px; color: #333">
            由于检测数据可得，您属于高风险状态，是由于体内糖的调节和利用出现了问题而导致的一类疾病。由于检测数据可得，您属于高风险状态，是由于体内糖的调节和利用出现了问题而导致的一类疾病
          </p>
        </div>
        <div class="summarize fz-10 plr-15 fz-26">
          <div class="header pl-15 flex flex-align-center">
            <p class="line"></p>
            <p style="color: #78adf5">建议</p>
          </div>
          <!-- <p
              class="lh-18 mt-5"
              v-for="(item, index) in detailInfo.suggestion"
              :key="index"
            >
              {{ index + 1 }}:{{ item.text }}
            </p> -->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { defineComponent, ref } from 'vue'
export default defineComponent({
  name: 'patientsInfo',
  setup() {
    const tablist = [
      {
        text: '甘油三酯',
        type: 'tri'
      },
      {
        text: '血糖',
        type: 'glu'
      },
      {
        text: '心率',
        type: 'pul'
      },
      {
        text: '尿酸',
        type: 'uri'
      },
      {
        text: '胆固醇',
        type: 'cho'
      },
      {
        text: '收缩压',
        type: 'sys'
      },
      {
        text: '舒张压',
        type: 'dia'
      }
    ]
    // let type = 'tri'
    let currentindex = ref(0)
    const changeTab = (index, itemtype) => {
      currentindex.value = index
      // type = itemtype
      console.log(itemtype)
    }
    return {
      tablist,
      currentindex,
      changeTab
    }
  }
})
</script>

<style lang="less" scoped>
.patientsInfo {
  background: #f9f9f9;
  .tag {
    display: flex;
    justify-content: space-between;
    .tag-item {
      font-size: 24px;
      width: 130px;
      height: 66px;
      line-height: 66px;
      padding-bottom: 2px;
      text-align: center;
    }
  }
  .chat-box {
    height: 588px;
    background: pink;
    margin-top: 27px;
  }
  .general-box {
    .bg-line {
      height: 18px;
      border-radius: 4px;
      background-color: #78adf5;
      margin: 0 auto;
    }
    .content-box {
      // position: relative;
      min-height: 163px;
      border-radius: 0 0 8px 8px;
      border-top: 6px solid #247cf2;
      background: #fff;
      margin: -6px auto 0;
      .posi {
        width: 50px;
        height: 50px;
        float: right;
        margin: 10px 10px 0 0;
      }
      .title {
        color: #1f1f1f;
        padding-top: 10px;

        .italic {
          display: inline-block;
          width: 6px;
          height: 20px;
          border-radius: 3px;
          background: #be67c1;
          transform: skewX(-22deg);
          margin-right: 3px;
        }
        .italic-blue {
          display: inline-block;
          width: 6px;
          height: 27px;
          margin-bottom: -3px;
          border-radius: 3px;
          background: #78adf5;
          transform: skewX(-22deg);
        }
      }
      .line {
        background-color: #78adf5;
        width: 6px;
        height: 25px;
        margin-right: 6px;
      }
    }
  }
}
.voice {
  padding-top: 10px;
  padding-left: 10px;
  float: right;
  height: 29px;
  width: 20px;
  background: #78adf5;
}

.bg {
  background: url()
    right 0 no-repeat;
  width: 24px;
  height: 24px;
  background-size: 400%;
}

.voicePlay {
  animation-name: voicePlay;
  animation-duration: 1s;
  animation-direction: normal;
  animation-iteration-count: infinite;
  animation-timing-function: steps(3);
}

@keyframes voicePlay {
  0% {
    background-position: 0;
  }
  100% {
    background-position: 100%;
  }
}
.active {
  font-size: 16px;
  font-weight: 600;
  color: #5389fe;
  background-color: #e8eefc;
  border-radius: 6px;
}
</style>
